package com.njbw.minio.entity;

import java.io.Serializable;

public class FileMultipartUploadReq implements Serializable {

    /**
     * 文件名称
     */
    private String objectName;

    private Integer chunkSize;

    public FileMultipartUploadReq() {
    }

    public FileMultipartUploadReq(Builder builder) {
        this.objectName = builder.objectName;
        this.chunkSize = builder.chunkSize;
    }

    public void checkNull() {
        if (this.objectName == null || this.objectName.isEmpty() || this.chunkSize == null) {
            throw new RuntimeException("请检查你的请求参数");
        }
    }

    public String getObjectName() {
        return objectName;
    }

    public void setObjectName(String objectName) {
        this.objectName = objectName;
    }

    public Integer getChunkSize() {
        return chunkSize;
    }

    public void setChunkSize(Integer chunkSize) {
        this.chunkSize = chunkSize;
    }

    public static class Builder {

        private String objectName;

        private Integer chunkSize;

        public Builder objectName(String objectName) {
            this.objectName = objectName;
            return this;
        }

        public Builder chunkSize(Integer chunkSize) {
            this.chunkSize = chunkSize;
            return this;
        }

        public FileMultipartUploadReq build() {
            return new FileMultipartUploadReq(this);
        }
    }

    @Override
    public String toString() {
        return "FileMultipartUploadReq{" +
                "objectName='" + objectName + '\'' +
                ", chunkSize=" + chunkSize +
                '}';
    }
}
